<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Homepage extends CI_Controller {
	function __construct() {
		parent::__construct();
		$this->load->model('core_model');
	}
	
	function index() {
		$data['pages'] 	   = 'beranda';
		$data['slidenews'] = $this->core_model->getwheredata('view_posting', array('publish_status'=>'Y'), 'stateid desc', array(0, 5));
		$data['recent']	   = $this->core_model->getwheredata('view_posting', array('publish_status'=>'Y'), 'stateid desc', array(5, 4));
		$data['popular']   = $this->core_model->getwheredata('view_posting', array('publish_status'=>'Y'), 'viewcount desc', array(0, 5));
		
		$category = $this->core_model->getalldata('tb_category','rand',array(0, 3));
		$ids = 0;
		foreach($category as $type) {
			$data['newstitle'][$ids] = $type['category_name'];
			$data['codecat'][$ids]   = $type['category_code'];
			$data['cat_news'][$ids]  = $this->core_model->getwheredata('view_posting', 
														array('publish_status'=>'Y', 'category_code'=>$type['category_code']), 
														'stateid desc', 
														array(0, 5));
			$ids++;
		}
		
		$this->load->view('template', $data);
	}
	
	function about() {
		$data['pages']= 'about';
		$this->load->view('template', $data);
	}
	
	function contact() {
		$data['pages'] = 'contact';
		$this->load->view('template', $data);
	}
	
	function product(){
		$data['pages'] = 'product';
		$this->load->view('template', $data);
	}
	
	function terms(){
		$data['pages'] = 'syarat';
		$this->load->view('template', $data);
	}
	
	function portofolio(){
		$data['pages'] = 'portofolio';
		$this->load->view('template', $data);
	}
	
}

/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */